<template>
  <div class="h-auto-full border">
    <div class="content ">
      <el-row>
        <el-button plain>朴素按钮</el-button>
        <el-button type="primary" plain>主要按钮</el-button>
        <el-button type="success" plain>成功按钮</el-button>
        <el-button type="info" plain>信息按钮</el-button>
        <el-button type="warning" plain>警告按钮</el-button>
        <el-button type="danger" plain>危险按钮</el-button>
      </el-row>
      <!-- <el-row>
        <div class="loading-box border" v-loading="loading2"
            element-loading-text="拼命加载中"
            element-loading-spinner="el-icon-loading"
            element-loading-background="rgba(0, 0, 0, 0.7)">

        </div>
        <div class="loading-box border">
          <Error message="加载失败"></Error>
        </div>
      </el-row> -->

    </div>
  </div>
</template>
<script>
import asiox from '../../api/get_data';
import localStorage from '../../util/local_storage';

export default {
  name: 'Home',
  data() {
    return {
      loading2: true,
      name: null,
      loadingPanel: null,
    };
  },
  async mounted() {
    //
    if (!this.name) {
      this.loadingPanel = this.$loading({
        lock: true,
        text: 'Loading',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)',
      });
    }
    const res = await asiox.getData1();
    // eslint-disable-next-line
    console.log("res=", res);
    if (!res || res.data === '') {
      this.loadingPanel.close();
      this.$error({ ms: '报错了' });
    } else if (res.data.username) {
      this.loadingPanel.close();
      const loginObj = {
        name: 'user',
        data: res.data,
      };
      localStorage.setLocal(loginObj);
    }
    // setTimeout(() => {
    //   this.loading2 = false;
    // }, 2000);
    // 获取列表
    // this['articles/axios_get_articles']();
  },

};
</script>
<style lang="scss" scoped>
.loading-box {
  width: 100%;
  height: 300px;
}
.el-icon-loading {
  color: #fff !important;
}
.el-loading-spinner .el-loading-text {
  color: #fff !important;
}
</style>

